﻿using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
using Netduino.Sensor.Data;

namespace Netduino.Sensor
{
    /// <summary>
    /// The executable part of the application
    /// </summary>
    public class Program
    {
        /// <summary>
        /// Main entry point of the Application
        /// </summary>
        public static void Main()
        {
            //allow the use of DHCP for the Network interface
            Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].EnableDhcp();

            var collector = new Collector();

            //build up the sensor stack
            //var firstAnalogSensor = new NakedSensor(new AnalogInput(Pins.GPIO_PIN_A0));
            //var secondAnalogSensor = new NakedSensor(new AnalogInput(Pins.GPIO_PIN_A1));
            //var thirdAnalogSensor = new NakedSensor(new AnalogInput(Pins.GPIO_PIN_A2));
            //var fourthAnalogSensor = new NakedSensor(new AnalogInput(Pins.GPIO_PIN_A3));
            //var fifthAnalogSensor = new NakedSensor(new AnalogInput(Pins.GPIO_PIN_A4));
            //var sixthAnalogSensor = new NakedSensor(new AnalogInput(Pins.GPIO_PIN_A5));
            //collector.Add(firstAnalogSensor);
            //collector.Add(firstAnalogSensor);
            //collector.Add(firstAnalogSensor);
            //collector.Add(firstAnalogSensor);
            //collector.Add(firstAnalogSensor);
            //collector.Add(firstAnalogSensor);
            //collector.Add(new FakedTemperatureSensor(new AnalogInput(Pins.GPIO_PIN_A0)));
            collector.Add(new Adxl335GSensorAxis(Pins.GPIO_PIN_A0, "x"));
            collector.Add(new Adxl335GSensorAxis(Pins.GPIO_PIN_A1, "y"));
            collector.Add(new Adxl335GSensorAxis(Pins.GPIO_PIN_A2, "z"));
            WebServer webServer = new WebServer(collector);
        }

    }
}
